package sandau.self_improvement_wall.service.impl;

import jakarta.validation.constraints.NotNull;
import org.springframework.stereotype.Service;
import sandau.self_improvement_wall.dto.TokenInfo;
import sandau.self_improvement_wall.service.TokenService;
import sandau.self_improvement_wall.utils.JWTUtils;

import java.util.HashMap;
import java.util.Map;


@Service
public class TokenServiceImpl implements TokenService {


    @NotNull
    private Map<String, String> generateJwtClaims(String accountId, String account) {
        Map<String,String> claims = new HashMap<>();
        claims.put("AccountId", accountId);
        claims.put("Account", account);
        return claims;
    }

    public TokenInfo generateToken(String accountId, String account){
        TokenInfo token = new TokenInfo();
        Map<String, String> claims = generateJwtClaims(accountId, account);
        String accessToken = JWTUtils.createAccessToken(claims, 20);
//        String refreshToken = JWTUtils.createRefreshToken(claims, tokenConfig.refreshTokenExp);
//        token.setRefreshToken(refreshToken);
        token.setAccessToken(accessToken);
        return token;
    }

    @Override
    public TokenInfo refreshToken(String refreshToken, String accessToken) {
        return null;
    }

}
